-
Couldn't load subscription status.
- Fork 429
Deprecate get_rr_node_indices() functions
#1805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…_grid_nodes_at_all_sides()
…d the use of get_rr_node_indices() functions
|
@vaughnbetz @hzeller This PR is ready for your review. |
vpr/src/device/rr_graph_builder.h
Outdated
| RRSpatialLookup& node_lookup(); | ||
| /* Add an existing rr_node in the node storage to the node look-up | ||
| * The node will be added to the lookup for every side it is on (for OPINs and IPINs) | ||
| * and for every (x,y) location at which it exists (for wires that span more than one (x,y). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo (probably in my original comment -- stray bracket in "(for"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my careless comments. Fixed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like some of these data structures (the "label" ones for example) are really storing track numbers, not RRNodeIds. Hence I think some of the vector type changes are incorrect/reduce clarity. Please take a look at the detailed comments and see if you agree.
If they are indeed RRNodeId vectors, then we should still make a change to avoid RRNodeId(UN_SET) and instead use RRNodeId::Invalid().
vpr/src/route/rr_graph2.cpp
Outdated
| } | ||
|
|
||
| if ((*incoming_wire_label[side_cw])[itrack] != UN_SET) { | ||
| if ((*incoming_wire_label[side_cw])[itrack] != RRNodeId(UN_SET)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cast looks strange to me. Is this data structure storing an rr_node index (RRNodeId) or an integer that represents something else? If it is storing an RRNodeId, it seems like we should get rid of UN_SET and instead use RRNodeID::Invalid as the sentinel value for not set yet (and update the commenting to match).
Right now both RRNodeId::Invalid() and UN_SET are -1 I think, so it will all work, but it seems strange to define a separate UN_SET invalid sentinel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this data structure is indeed storing an RRNodeId it would be good to add a comment to that effect in this routine and in the data structure definition (unless there is one already, but I didn't find it). From a quick look at the code I couldn't quite figure out if this incoming_wire_label data structure is storing some kind of track index, or if it's a unique rr_node id. If you know the answer to that Xifan, it would be good to add a comment now.
| * If seg_type_index == UNDEFINED, all segments in the channel are considered. Otherwise this routine | ||
| * only looks at segments that belong to the specified segment type. */ | ||
|
|
||
| std::vector<int>& labels = *labels_ptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these "labels" actually RRNodeIDs, or are they track numbers, or something else? Depending on the answer, they should stay ints, or be converted to RRNodeIds as this PR does. The comment should be updated to explain what a label is (is it an RRNodeId, a track number, or something else?
|
|
||
| /* Alloc the list of labels for the tracks */ | ||
| labels.resize(max_chan_width); | ||
| std::fill(labels.begin(), labels.end(), UN_SET); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment on UN_SET -- seems like it should be RRNodeId::Invalid() if this is actually storing an rr_node index. And if it isn't, we should change the type of the vector back to int.
| RRNodeId max_track = RRNodeId::INVALID(); | ||
|
|
||
| for (int i = 0; i < num_wire_muxes; i++) { | ||
| if (wire_mux_on_track[i] == from_track) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like label is a track number here (from 0 to W-1) so this implies "labels" are really "track numbers" and should be kept as ints, I think.
vpr/src/route/rr_graph2.h
Outdated
|
|
||
| typedef vtr::NdMatrix<short, 6> t_sblock_pattern; | ||
|
|
||
| struct t_opin_connections_scratchpad { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to comment what this is for, if you know. Why a dimension of 8?
Does it store RRNodeIds, or is it some tile structure that stores track numbers or some such (which would be better left as an int)?
|
Hi @vaughnbetz My thoughtsAfter give a in-depth read on the codes, I think you are right.
To summarize, in current codes, its usage is mixed.
The first group denotes the output ports of a switch block
The second group denotes the incoming wires, which are the input ports of a switch block
Detailed AnalysisThe
vtr-verilog-to-routing/vpr/src/route/rr_graph.cpp Lines 618 to 657 in d3449e8
vtr-verilog-to-routing/vpr/src/route/rr_graph.cpp Lines 1182 to 1198 in d3449e8
The following functions uses the scratch pad
Action itemsI think that the scratchpad creates a lot of mess between functions.
Actually, my opinion in the refactoring
Let me know what you think. We can converge on the action items. I can do refactoring accordingly. |
|
Thanks for the detailed analysis Xifan. I agree with your proposal -- making these local variables of the right type seems like the best approach. |
…ded comments to clarify the use of scratchpad
|
@vaughnbetz Thanks for the input. I have remove the use of The PR is ready for your review. |
|
Do not know why the sanity basic tests failed. I am looking into the problems. I will ping you when the CI is green. Then it is truely ready for code review. |
|
Maybe without the scratchpads we're doing huge amounts of memory traffic and memory fragmentation? |
Yes. I checked the log files in the basic regression tests in sanity mode. It explodes the RAM size. In some tests, the peak memory usage is 6Gb, which caused the CI runner abort. However, the scatchpad is only called in rr_graph builder but we did not see a sharp increase in the memory. I am trying to find out a solution about how to reduce the peak memory usage when debug mode is on. Attached some lines from log file from https://github.com/verilog-to-routing/vtr-verilog-to-routing/pull/1805/checks?check_run_id=3118949531 |
|
The placer builds the rr-graph to compute the place delay matrix (uses a router-like algorithm) so the rr-graph would be built there. |
Yes. I am checking my previous PRs. I remember I did modify a function in placer, which may be source of these mess. |
|
A todo list as a reminder before PR can be merged. Upload QoR comparison between the current branch and the VTR before refactoring (will create a branch based on current master and revert back a number of commits) on the following tests:
|
|
Just tried the titian benchmarks on this PR. The gaussianblur benchmarks cannot be routed. I am going to run the titan benchmarks on an old master (before refactoring happens), with an aim to spot which PR caused the problem. Attached the log file: |
|
@tangxifan : seems like two issues:
|
|
@vaughnbetz Got it. Let me try to rerun and if the seed noise is indeed a problem. I will keep you posted. Meanwhile, I have finished the QoR test on the VTR benchmark.
|
|
Just finished the QoR check on the titan_quick_qor test case A short summary
Details can be found in the attached spreadsheet |
|
Finished the basic sanity tests.
Details can be found in the attached spreadsheet |
|
@vaughnbetz As suggested, I have completed the QoR checks on Titan, VtR and sanity basic benchmarking. No changes on peak memory usage. Small changes on runtime is observed. See if it is good to go. |
|
Looks good; thanks @tangxifan . LU_Network didn't finish on the titan_quick_qor_test, but since it is tested in CI and CI is green, that must be a transient issue. |
Description
This PR focuses on updating routing resource graph builder functions, where we use the refactored data structure
RRGraphBuilderto replace the legacy data structurerr_node_indices.This PR aims to eliminate the
get_rr_node_indices()functions in the RRGraph builders, as one step further in deprecating the legacy data structure.After this PR, the
rr_node_indicesdata structure is only used in theverify_rr_node_indices()function:vtr-verilog-to-routing/vpr/src/route/rr_graph2.cpp
Lines 1153 to 1156 in d3449e8
The
verify_rr_node_indices()may be an API of theRRGraphBuilderdata structure, since it is a validator.Checklist:
add_nodes_at_all_locs()as requested in PR DeployRRGraphBuilderin RRGraph Reader and Writer to replace the use ofrr_node_indices#1800find_grid_nodes_at_all_sides()toRRSpatialLookupand remove APIfind_sink_nodes()get_rr_node_indices()functionst_opin_connection_scratchpadand use local variables insteadRRSpatialLookupAPIs (A lot of rework still needed)Related Issue
Motivation and Context
This pull request is a follow-up PR on the routing resource graph refactoring effort #1801
How Has This Been Tested?
After the previous PR #1801 , we start reworking all the source files that use the legacy data structure
rr_node_indicesin a high priority, in order to deprecate the legacy data structure as soon as possible.Current statistics on the files that use
rr_node_indices(in total there are 143 lines related):This PR will remove the use in
Types of changes
Checklist: